from flyweightpattern.flyweightfactory import FlyweightFactory
from flyweightpattern.unsharedconcreteflyweight import UnsharedConcreteFlyweight

factory = FlyweightFactory()
f01 = factory.get_flyweight('a')
f02 = factory.get_flyweight('a')
f03 = factory.get_flyweight('b')
f04 = factory.get_flyweight('b')
f01.operation(UnsharedConcreteFlyweight('第1次调用a'))
f01.operation(UnsharedConcreteFlyweight('第2次调用a'))
